ArcPad Scripting Object Model
Zoom to Layer
Send Feedback
ArcPad Scripting Object Model Reference > ArcPad Scripting Samples > Zoom to Layer

Glossary Item Box

Description:

This sample zooms the current map to the extent of a layer. For simplicity sake, the first layer in the map is used.

How to use:

  1. Paste the JScript or VBScript code into the Script dialog box (depending on which language is set as the default scripting language).
  2. Modify the code to get the desired layer.
  3. Click/Tap the Execute icon.

 

JScript

Copy Code
function ZoomToLayer()
{
  var pLayer;
  if (Map.Layers.Count == 0)
    return;
  pLayer = Map.Layers(1);
  Map.Extent = pLayer.Extent;
  Map.Refresh();
  pLayer = null;
}
ZoomToLayer();
 

VBScript

Copy Code
Sub ZoomToLayer()
  Dim pLayer
  If Map.Layers.Count = 0 Then Exit Sub
  Set pLayer = Map.Layers(1)
  Map.Extent = pLayer.Extent
  Map.Refresh
  Set pLayer = Nothing
End Sub
Call ZoomToLayer()
 
©2012. All Rights Reserved.